import { constantRoutes } from '@/router'

interface stateType {
  routes: Array<any>,
}
export default {
  namespace: true,
  state: {
    routes: []
  },
  getters: {
    menuData: (state:any) => {
      const menuRoute = state.routes.filter((item:any) => {
        return item.path === '/'
      });
      return menuRoute.children;
    }
  },
  mutations: {
    SET_ROUTES: (state: stateType, routes:any) => {
      state.routes = [...constantRoutes, ...routes]
    }
  },
  actions: {
    getRoutes({ commit }:any) {
      commit('SET_ROUTES', [])
    },
  }
};